import request from '@/api/request'
import { IPaginationForm, ResponseFormat, ResponseFormatWithRows } from '@/types/http'

// 根据日期查询的数据
export const queryByDate = (data: IPaginationForm): Promise<ResponseFormat> => {
  return request.post('/statistics/queryDayData', data)
}

export const queryAwsData = (data: IPaginationForm): Promise<ResponseFormat> => {
  return request.post('/attempt-customer/find', data)
}

/**
 * @breif: 今日统计数据 1 按年份返回 2 按月份返回 3 按日期返回
 * @param {*} type
 * @param {*} date: yyyy-MM-dd 格式
 * @return {*}
 */
export const queryReviewStatistic = (type, date): any => {
  return request.get('/statistics/reviewStatistic', { params: { type, date } })
}

// 询盘量
export const queryAwsStatistic = (type, date): any => {
  return request.get('/statistics/queryStatistic', { params: { type, date } })
}

// 新增一条数据
export const addOne = (): any => {
  return request.post('/statistics')
}

export const queryByMonth = (data: IPaginationForm): Promise<ResponseFormat> => {
  return request.post('/statistics/queryMonth', data)
}

// 查询轮播配置
export const queryConfiguration = (data: IPaginationForm): Promise<ResponseFormatWithRows> => {
  return request.post('/configuration/find', data)
}

// 新增轮播
export const createConfiguration = (data:any): Promise<ResponseFormat> => {
  return request.post('/configuration/create', data)
}

// 修改轮播
export const updateConfiguration = (data: any): Promise<ResponseFormat> => {
  return request.post('/configuration/update', data)
}

// 删除轮播
export const deleteConfiguration = (params: any): Promise<ResponseFormat> => {
  return request.get('/configuration/delete', { params })
}
